package cn.fl.dk.web.service;

import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.exception.BaseException;
import cn.fl.dk.facade.condition.DkBillDtlQC;
import cn.fl.dk.facade.condition.DkPaySchMQC;
import cn.fl.dk.facade.dto.DkBillDtlDTO;
import cn.fl.dk.web.vo.DkBillDtlVO;
import cn.fl.dk.web.vo.DkPaySchMVO;

import java.util.List;

/**
 * @Description: 垫款单明细表 客户端服务层接口
 * @Description: 持久层方法名称前缀：新增：insert* 删除：delete* 修改：update* 批量：batch* 查询对象：select* get* find* 查询集合：select*
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
public interface IDkBillDtlService {
	
	/**
	 * 获取唯一对象
	 * @param id 主键
	 * @return 对象DTO
	 */
	public DkBillDtlVO selectById(Long id)throws BaseException;
	
	/**
	 * 新增
	 * @param entity
	 * @return
	 */
    public Long add(DkBillDtlVO entity) throws BaseException;

    /**
     * 删除
     * @param id
     * @return
     */
    public boolean removeById(Long id)throws BaseException;
    
    /**
     * 删除
     * @param ids
     * @return
     */
    public boolean removeByIds(List<Long> ids)throws BaseException;

    /**
     * 修改
     * @param entity
     * @return
     */
    public boolean modify(DkBillDtlVO entity)throws BaseException;

    /**
     * 分页查询所有
     * @param page
     * @return
     */
    public Pager searchListPage(Pager page)throws BaseException;

	public DataResultDTO updateCalcrstCd(String billId);

    /**
     * 推送问卷
     * @param billId 垫付单Id
     * @return
     * @throws BaseException
     */
    public DataResultVO addAndpushQuestionnaire(Long billId)throws BaseException;
    
    public DkBillDtlVO selectByRuleFlag(String ruleFlag);

	/**
	 * 推送小贷合同
	 * @param billId 垫款明细Id
	 * @return
	 */
    public DataResultVO pushContract(Long billId);
    
    /**
     * 关联合同：查询所有
     * @Title: searchList
     * @param @param condition
     * @param @return
     * @param @throws BaseException
     * @author gaoyongfei
     * @date 2018-6-15 上午10:22:52
     * @return List<DkBillDtlDTO> 
     * @throws
     */
    public List<DkBillDtlDTO> searchlListByContractLog(DkBillDtlQC condition) throws BaseException;
	
	public List<DkBillDtlDTO> searchDkBillDtlList(DkBillDtlQC condition) throws BaseException;
	/**
	 * 执行前：更新实际垫款金额 
	 * @Title: handleAfterUpdateInfo
	 * @param @param lists
	 * @author gaoyongfei
	 * @date 2018-7-2 下午7:09:50
	 * @return void 
	 * @throws
	 */
	public void handleAfterUpdateInfo(List<DkBillDtlDTO> lists);

	public DataResultDTO doDk(DkBillDtlQC dkBillDtlQC) throws BaseException;

	/**
	 * 明垫支付表
	 * @param condition
	 * @return
	 * @throws BaseException
	 */
	public List<DkPaySchMVO> selectMingDianPaySchMList(DkPaySchMQC condition) throws BaseException;

	/**
	 * 执行明垫
	 * @param paySchIdList
	 * @param ruleId
	 * @param billId
	 */
    DataResultDTO doMingDian(List<Long> paySchIdList, Long ruleId, Long billId);
	/**
	 * 明垫支付表
	 * @param pager
	 * @return
	 */
	Pager selectMingDianPaySchMListPage(Pager pager);
}
